package com.qdaily.ui.net.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 問題詳情，問題選項。
 * Created with IntelliJ IDEA.
 * User: Felix
 * Date: 3/30/15
 * Time: 18:09
 * QQ:74104
 * Email:lovejiuwei@gmail.com
 */
public class QuestionDetailOptions implements Parcelable {
    private int id = 0;
    private String content = "";
    private String image = "";
    private int height = 0;
    private int width = 0;
    private int perfect = 1;
    private int praise_count = 0;
    private boolean selected;
    private ArticleInfoAuthor author = null;

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getPerfect() {
        return perfect;
    }

    public void setPerfect(int perfect) {
        this.perfect = perfect;
    }

    public int getPraise_count() {
        return praise_count;
    }

    public void setPraise_count(int praise_count) {
        this.praise_count = praise_count;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public ArticleInfoAuthor getAuthor() {
        return author;
    }

    public void setAuthor(ArticleInfoAuthor author) {
        this.author = author;
    }

    @Override
    public String toString() {
        return "QuestionDetailOptions{" +
                "id=" + id +
                ", content='" + content + '\'' +
                ", image='" + image + '\'' +
                ", height=" + height +
                ", width=" + width +
                ", perfect=" + perfect +
                ", praise_count=" + praise_count +
                ", selected=" + selected +
                ", author=" + author +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.content);
        dest.writeString(this.image);
        dest.writeInt(this.height);
        dest.writeInt(this.width);
        dest.writeInt(this.perfect);
        dest.writeInt(this.praise_count);
        dest.writeByte(selected ? (byte) 1 : (byte) 0);
        dest.writeParcelable(this.author, 0);
    }

    public QuestionDetailOptions() {
    }

    private QuestionDetailOptions(Parcel in) {
        this.id = in.readInt();
        this.content = in.readString();
        this.image = in.readString();
        this.height = in.readInt();
        this.width = in.readInt();
        this.perfect = in.readInt();
        this.praise_count = in.readInt();
        this.selected = in.readByte() != 0;
        this.author = in.readParcelable(ArticleInfoAuthor.class.getClassLoader());
    }

    public static final Creator<QuestionDetailOptions> CREATOR = new Creator<QuestionDetailOptions>() {
        public QuestionDetailOptions createFromParcel(Parcel source) {
            return new QuestionDetailOptions(source);
        }

        public QuestionDetailOptions[] newArray(int size) {
            return new QuestionDetailOptions[size];
        }
    };
}
